var formatTime = require("../components/fotmatTime.js");
var $realTime;

// 设置实时时间表
function setRealTime() {
    var nowTime = new Date();
    var timeStr = formatTime.format1(nowTime);
    $realTime.text(timeStr);
    setInterval(function() {
        nowTime.setTime(nowTime.getTime() + 1000);
        timeStr = formatTime.format1(nowTime);
        $realTime.text(timeStr);
    }, 1000);

}

// 初始化变量
function initView() {
    $realTime = $("#real-time");
    setRealTime();
}

module.exports = {
    initView: initView
}